import Quote from '~/components/text/quote'
import Example from '~/components/example'
import { Code, InlineCode } from '~/components/text/code'
import Link from '~/components/text/link'

export const meta = {
  editUrl: 'pages/docs/api/v1/api-docs-mdx/errors/deployments.mdx',
  lastEdited: '2019-08-15T13:57:53.000Z'
}

## Deployment Errors

These error code could happen when using any [deployment related endpoint](#endpoints/deployments).

### Missing Files

Some of the files you defined when creating the deployment are missing.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "missing_files",
      "message": "Missing files",
      "missing": []
    }
  }`}</Code>
</Example>

### No Files in the Deployment

You tried to create an empty deployment.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "no_files",
      "message": "No files in the deployment"
    }
  }`}</Code>
</Example>

### Too Many Active Deployment Instances

You reached the limit of running instances, you need to remove or scale down another deployment before creating a new one.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "instance_concurrency_exceeded",
      "message": "Too many active deployment instances"
    }
  }`}</Code>
</Example>

### Too Many Environment Variables

The limit of environment variables per deployment is 100 and you defined more. The error message indicates the amount you define.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_too_many_keys",
      "message": "Too many env vars have been supplied (100 max allowed, but got #)"
    }
  }`}
  </Code>

<Quote><InlineCode>#</InlineCode> is your number of variables.</Quote>
</Example>

### Environment Variable Key with Invalid Characters

Some environment variable name contains an invalid character. The only valid characters are letters, digits and `_`.

The error message will contain the `KEY` with the problem.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_key_invalid_characters",
      "message": "The env key "KEY" contains invalid characters. Only letters, digits and \`_\` are allowed",
      "key": KEY
    }
  }`}</Code>
</Example>

### Environment Variable Key with a Long Name

An environment variable name is too long, the maximum permitted name is 256 characters.

The error message contains the environment `KEY`.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_key_invalid_length",
      "message": "The env key "KEY" exceeds the 256 length limit",
      "key": KEY
    }
  }`}</Code>
</Example>

### Environment Variable Value with a Long Name

An environment variable value contains a value too long, the maximum permitted value is 65536 characters.

The error message contains the environment `KEY`.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_value_invalid_length",
      "message": "The env value for "KEY" exceeds the 65536 length limit",
      "key": KEY,
      "value": VALUE
    }
  }`}</Code>
</Example>

### Environment Variable Value Is an Object without UID

The value of an environment variable is object but it doesn't have a uid.

The error message contains the environment `KEY` which has the error.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_value_invalid_type_missing_uid",
      "message": "The env key "KEY" passed an object as a value with no \`uid\` key"
    }
  }`}</Code>
</Example>

### Environment Variable Value Is an Object with Unknown Props

The value of an environment variable is an object with unknown attributes, it only can have a `uid` key inside the object.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_value_invalid_type_unknown_props",
      "message": "The env key "KEY" passed an object with unknown properties. Only \`uid\` is allowed when passing an object"
    }
  }`}</Code>
</Example>

### Environment Variable Value with an Invalid Type

An environment variable value passed is of an unsupported type.

The error message contains the environment `KEY`.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_value_invalid_type",
      "message": "The env key "KEY" passed an unsupported type for its value",
      "key": KEY
    }
  }`}</Code>
</Example>

### Not Allowed to Access a Secret

You're trying to use a secret but you don't have access to it.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_secret_forbidden",
      "message": "Not allowed to access secret \\"NAME\\"",
      "uid": UID
    }
  }`}</Code>
</Example>

### Missing Secret

You're trying to use a secret as an environment value and it doesn't exists.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "env_secret_missing",
      "message": "Could not find a secret by uid "UID"",
      "uid": UID
    }
  }`}</Code>
</Example>

### Invalid Session Affinity Value

You tried to set session affinity with an invalid value. Only allowed values are `ip` or `random`.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "invalid_session_affinity",
      "message": "Session affinity must be ip or random"
    }
  }`}</Code>
</Example>

### Wrong Value for public Property

You tried to create a deployment on the OSS plan with the `public` property
either set to `false` or not set at all.

On the OSS plan, it is required that you set this property to `true` in
order to explicitly acknowledge that the deployment's code will be
publicly accessibly.

<Example>
  <Code lang="json">{`{
    "error": {
      "code": "plan_requires_public",
      "message": "Your plan (OSS) requires the deployment to be marked as public."
    }
  }`}</Code>
</Example>
